package com.dandandog.framework.faces.aspect;

import lombok.AllArgsConstructor;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Pointcut;
import org.primefaces.PrimeFaces;

/**
 * @Author: JohnnyLiu
 * @Date: 2021/11/11 16:42
 */
@AllArgsConstructor
public abstract class AbstractFacesErrorAspect implements INotice {


    @Pointcut("target(com.dandandog.framework.faces.controller.FacesController) && execution(public void *(..)) ")
    public void point() {
    }

    @AfterThrowing(value = "point()", throwing = "ex")
    public void unifiedExceptionHandler(Exception ex) {
        ex.printStackTrace();
        PrimeFaces.current().ajax().addCallbackParam("isExpired", true);
    }
}
